package com.controller;

import com.pojo.ParkingLot;
import com.service.ParkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@CrossOrigin
@RestController
@RequestMapping("/Park")
public class ParkController {
    @Autowired
    private ParkService parkService;

    @RequestMapping("/findALL")
    public List<ParkingLot> findAll(){

        System.out.println("进入到了findALL...");
        List<ParkingLot> all = parkService.findALL();
        System.out.println("执行完了findALL...");
        return all;
    }

    /*根据那个小区来返回停车位*/
    @RequestMapping("/findByAddress")
    public List<ParkingLot> findByAddress(int number){

        System.out.println("进入到了findByAddress...");

        List<ParkingLot> byAddress = parkService.findByAddress(number);

        System.out.println("执行完了findByAddress...");

        return byAddress;
    }

}
